﻿<Window x:Class="SeqcosGui.SeqcosMainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{StaticResource QualityControl_AppName}" mc:Ignorable="d" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        MinHeight="660" MinWidth="800" Height="660" Width="840" Icon="/SeqcosGui;component/Images/Bio.ico" Closing="OnWindowClosing" IsEnabled="True">
    <!-- Set style templates -->
    <Window.Resources>
        <Style x:Key="TableHeaderRow" TargetType="{x:Type Label}">
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
        
        <Style x:Key="RowHeaderCell" TargetType="{x:Type TextBlock}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="TextWrapping" Value="Wrap" />
        </Style>
        
        <Style x:Key="RowDataCell" TargetType="{x:Type TextBox}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="HorizontalAlignment" Value="Left" />
            <Setter Property="TextWrapping" Value="Wrap" />
            <Setter Property="Background" Value="Transparent" />
            <Setter Property="IsReadOnly" Value="True" />
            <Setter Property="BorderThickness" Value="0" />
        </Style>
        
    </Window.Resources>
    
    <!-- Controls the entire layout of the application -->
    <Grid Name="menuBarGrid" Margin="4,0,4,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="900*" />
        </Grid.RowDefinitions>
        
        <!-- Menu Bar -->
        <StackPanel Orientation="Horizontal" Grid.Row="0" Width="auto" Name="menuBar">
            <Menu Height="30" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding ElementName=mainGrid,Path=ActualWidth}" FontSize="14" IsEnabled="True">
                <!-- File -->
                <MenuItem Header="_File">
                    <MenuItem Header="{DynamicResource MenuBar_File_Run}" IsEnabled="True" Click="OnNewRunClicked" />
                    <Separator />
                    <MenuItem Header="{DynamicResource MenuBar_File_Load}" IsEnabled="True" Click="OnLoadRunClicked"/>
                    <Separator />
                    <MenuItem Header="{DynamicResource MenuBar_File_Exit}" Click="OnExitMenuClicked" />
                </MenuItem>
            
                <!-- Tools -->
                <MenuItem Header="{DynamicResource MenuBar_Tools}">
                    <MenuItem Header="{DynamicResource MenuBar_Tools_Trim}" Uid="QualityScore">
                        <MenuItem Header="{DynamicResource MenuBar_Tools_ByLength}" Click="OnTrimClick" Uid="TrimByLength" />
                        <MenuItem Header="{DynamicResource MenuBar_Tools_ByQualityScore}" Click="OnTrimClick" Uid="TrimByQualityScore" />
                        <MenuItem Header="{DynamicResource MenuBar_Tools_ByRegex}" Click="OnTrimClick" Uid="TrimByRegex" />
                    </MenuItem>
                    <MenuItem Header="{DynamicResource MenuBar_Tools_Discard}">
                        <MenuItem Header="{DynamicResource MenuBar_Tools_ByLength}" Click="OnDiscardClick" Uid="DiscardByLength" />
                        <MenuItem Header="{DynamicResource MenuBar_Tools_ByQualityScore}" Click="OnDiscardClick" Uid="DiscardByQualityScore"/>
                        <MenuItem Header="{DynamicResource MenuBar_Tools_ByRegex}" Click="OnTrimClick" Uid="TrimByRegex" />
                    </MenuItem>
                </MenuItem>
            
                <!-- Help -->
                <MenuItem Header="_Help">
                    <MenuItem Header="{DynamicResource MenuBar_HelpMenu_UserGuide}" Click="OnViewHelpClicked" />
                    <MenuItem Header="{DynamicResource MenuBar_HelpMenu_About}" Click="OnAboutClicked" />
                </MenuItem>
                <Menu.Background>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="White" Offset="0" />
                        <GradientStop Color="#FF00007D" Offset="1" />
                    </LinearGradientBrush>
                </Menu.Background>
            </Menu>
        </StackPanel>
        <!-- -->
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
            <TextBlock FontSize="16" Margin="0,2,5,0" Foreground="#FFFFFFFF" Text="{DynamicResource QualityControl_AppName}" />          
        </StackPanel>

        <!-- Main chart area -->
        <Grid Grid.Row="1" Name="mainGrid" ClipToBounds="True">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="5*" />
                <ColumnDefinition Width="250" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="5*" />
                <RowDefinition Height="130" MinHeight="130"/>
            </Grid.RowDefinitions>
            <!-- Chart Area -->
            <GroupBox Grid.Row="0" Grid.Column="0" Header="{DynamicResource Groupbox_Header_Chart}" ClipToBounds="True" Name="groupBoxChart">
                    <!-- MaxWidth="{Binding ElementName=chartGroupBox, Path=Width}" MaxHeight="{Binding ElementName=chartGroupBox, Path=Height}" -->
                    <Image RenderOptions.BitmapScalingMode="HighQuality" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Stretch" Name="imageMainChart" Stretch="Fill" VerticalAlignment="Stretch" Margin="6,6,6,6" MouseWheel="OnMainImageMouseWheel" >
                        <Image.ContextMenu>
                            <ContextMenu>
                                <MenuItem Name="menuMainChartOpen" IsEnabled="False" Header="{DynamicResource Thumbnail_ContextMenu_OpenInExplorer}" Click="OnChartAreaExplorerClick" />
                            </ContextMenu>
                        </Image.ContextMenu>
                    </Image>

            </GroupBox>

            <!-- Tab Navigation Control -->
            <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" MinHeight="120">
                <TabControl VerticalAlignment="Bottom" HorizontalAlignment="Left" Height="120" MinWidth="270" Margin="4,0,0,4">
                    <TabItem Header="{DynamicResource TabControl_Sequence}">
                        <StackPanel Orientation="Horizontal" Name="sequenceTab" />
                    </TabItem>
                </TabControl>

                <TabControl VerticalAlignment="Bottom" HorizontalAlignment="Left" Height="120" MinWidth="270" Margin="4,0,0,4">
                    <TabItem Header="{DynamicResource TabControl_QualityScore}">
                        <StackPanel Orientation="Horizontal" Name="qualityTab" />
                    </TabItem>
                </TabControl>
            </StackPanel>

            <!-- Basic stats data grid -->
            <GroupBox Grid.Column="1" Grid.Row="0" Header="{DynamicResource Groupbox_Header_InputSummary}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40*" />
                        <RowDefinition Height="374*" />
                    </Grid.RowDefinitions>
                    
                    <StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center">
                        <TextBlock Name="totalReadsHeading" Style="{StaticResource RowHeaderCell}" Text="{DynamicResource Stats_TotalReadsTitle}"/>
                        <TextBox Name="totalReadsValue" Style="{StaticResource RowDataCell}" />
                    </StackPanel>
                    
                    <Grid Grid.Row="1" Name="basicStatsGrid">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="30" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="2*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        
                        <Label Grid.Column="0" Grid.Row="0" Style="{StaticResource TableHeaderRow}" Content="{StaticResource Stats_DescriptionTitle}" />
                        <Label Grid.Column="1" Grid.Row="0" Style="{StaticResource TableHeaderRow}" Content="{StaticResource Stats_MinTitle}" />
                        <Label Grid.Column="2" Grid.Row="0" Style="{StaticResource TableHeaderRow}" Content="{StaticResource Stats_MaxTitle}" />
                        <Label Grid.Column="3" Grid.Row="0" Style="{StaticResource TableHeaderRow}" Content="{StaticResource Stats_MeanTitle}" />

                        <TextBlock Grid.Column="0" Grid.Row="1" Style="{StaticResource RowHeaderCell}" Text="{StaticResource Stats_ReadLength}" />
                        <TextBox Grid.Column="1" Grid.Row="1" Style="{StaticResource RowDataCell}" Name="readLengthMinValue" />
                        <TextBox Grid.Column="2" Grid.Row="1" Style="{StaticResource RowDataCell}" Name="readLengthValue" />
                        <TextBox Grid.Column="3" Grid.Row="1" Style="{StaticResource RowDataCell}" Name="readLengthMeanValue" />

                        <TextBlock Grid.Column="0" Grid.Row="2" Style="{StaticResource RowHeaderCell}" Text="{StaticResource Stats_ReadGcContent}" />
                        <TextBox Grid.Column="1" Grid.Row="2" Style="{StaticResource RowDataCell}" Name="readGcContentMinValue" />
                        <TextBox Grid.Column="2" Grid.Row="2" Style="{StaticResource RowDataCell}" Name="readGcContentMaxValue" />
                        <TextBox Grid.Column="3" Grid.Row="2" Style="{StaticResource RowDataCell}" Name="readGcContentMeanValue" />

                        <TextBlock Grid.Column="0" Grid.Row="3" Style="{StaticResource RowHeaderCell}" Text="{StaticResource Stats_BasePhred}" />
                        <TextBox Grid.Column="1" Grid.Row="3" Style="{StaticResource RowDataCell}" Name="basePhredMinValue" />
                        <TextBox Grid.Column="2" Grid.Row="3" Style="{StaticResource RowDataCell}" Name="basePhredMaxValue" />
                        <TextBox Grid.Column="3" Grid.Row="3" Style="{StaticResource RowDataCell}" Name="basePhredMeanValue" />

                        <TextBlock Grid.Column="0" Grid.Row="4" Style="{StaticResource RowHeaderCell}" Text="{StaticResource Stats_ReadPhred}" />
                        <TextBox Grid.Column="1" Grid.Row="4" Style="{StaticResource RowDataCell}" Name="readPhredMinValue" />
                        <TextBox Grid.Column="2" Grid.Row="4" Style="{StaticResource RowDataCell}" Name="readPhredMaxValue" />
                        <TextBox Grid.Column="3" Grid.Row="4" Style="{StaticResource RowDataCell}" Name="readPhredMeanValue" />
                    </Grid>
                </Grid>
            </GroupBox>

            <!-- Display properties of image that is currently in view -->
            <GroupBox Grid.Column="1" Grid.Row="1" Header="{DynamicResource Groupbox_Header_ImageProperties}">
                <TextBox Height="Auto" HorizontalAlignment="Left" Margin="0,14,0,0" Name="textImageProperties" VerticalAlignment="Top" Width="Auto" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
                </TextBox>
            </GroupBox>
        </Grid>

    </Grid>
</Window>
